data Expression = TermType Term | Neg Term | Sum Expression Term | Diff Expression Term
data Term = FaktorType Faktor | Prod Term Faktor
data Faktor = Num Int | ExpressionType Expression

evalExpr:: Expression -> Int
evalExpr (TermType t) = evalTerm t
evalExpr (Neg t) = -(evalTerm t)
evalExpr (Sum t1 t2) = (evalExpr t1)+(evalTerm t2)
evalEcpr (Diff t1 t2) = (evalExpr t1)+(evalTerm t2)

evalTerm:: Term->Int
evalTerm (FaktorType t) = (evalFactor t)
evalTerm (Prod t1 t2) = (evalTerm t1)*(evalFactor t2)

evalFactor:: Faktor -> Int
evalFactor (Num t) = t
evalFactor (ExpressionType t) = (evalExpr t)